import { ADD_VAL, CLEAR_VAL } from '../type'

const data = {name: 'Tom'}

export const user = (state = data, action = {}) => {
    const { type, payload } = action;
    console.log('reduces--',action)
    switch (type) {
      case ADD_VAL:
        return { ...state, name: payload}
      case CLEAR_VAL:
        return { ...state, name: payload}
      default: return state;
    }
};